package chapter3_array;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by yuh on 2018/4/9.
 */
public class Intersection {
    static Pattern pattern = Pattern.compile("\\{[^}]*\\}?");

    public static void main(String[] args) {

        String str = "[{\"name\":\"yuhao\",\"age\":24}{\"name\":\"yuhao\",\"age\":24},{\"name\":\"yuhao\",\"age\":24}]";
        Matcher matcher = pattern.matcher(str);
        while(matcher.find()){
            System.out.println(matcher.group());
        }
        /* int[] arr1 = {1, 2, 3, 3};
        int[] arr2 = {2, 3, 3, 3, 4};
        LinkedList<Integer> list = new LinkedList<>();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i : arr1) {
            if (map.get(i) == null) {
                map.put(i, 1);
            } else {
                map.put(i, map.get(i) + 1);
            }
        }
        for (int i : arr2) {
            Integer num = map.get(i);
            if (num != null && num > 0) {
                list.add(i);
                map.put(i, num - 1);
            }
        }
        System.out.println(list);*/

    }
}

